package com.koron.configure.feign.operation.dto;

import cn.hutool.core.util.StrUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.commons.collections4.CollectionUtils;

import java.util.List;

/**
 * @author jzp
 * @since 2021/10/20
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class ClassesShiftDTO extends ClassesShift {
    @ApiModelProperty("人员列表")
    private List<ClassesStaff> staffs;

    public String toStaffStr() {
        StringBuilder str = new StringBuilder();
        List<ClassesStaff> classesStaffList = this.staffs;
        if (CollectionUtils.isEmpty(classesStaffList)) {
            return "";
        }
        for (ClassesStaff staff : classesStaffList) {
            str.append(staff.getStaffName());
            if ("0".equals(staff.getType())) {
                str.append("|");
            } else {
                str.append(",");
            }
        }
        return StrUtil.strip(str, ",");
    }
}
